<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>作用域01</title>
    <script src="angularjs/angular.min.js"></script>
</head>
<body>

    <div id="out"></div>

    <div ng-app="app">
        <div ng-controller="ctrl">
            <input type="text" ng-model="site"/>
            <p>{{site}}</p>
        </div>
    </div>

    <script>
        angular.module("app",[])
                .run(function ($rootScope) {
                    $rootScope.site = "doramart.com";
                })
                .controller("ctrl",function($scope,$compile){


                    var dom = angular.element("<h3>site - {{site}}</h3>");

//                    out.appendChild(dom[0]);
                    var linkFn = $compile(dom);
                    var childScope = $scope.$new();

                    linkFn(childScope);
                    document.querySelector("#out").appendChild(dom[0]);
                })
    </script>
</body>
</html>